home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gp_nsync.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.2 KB  |  113 lines

  1. /* Copyright (C) 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gp_nsync.c,v 1.2 2000/09/19 19:00:24 lpd Exp $ */
  20. /* Dummy thread / semaphore / monitor implementation */
  21. #include "std.h"
  22. #include "gserror.h"
  23. #include "gserrors.h"
  24. #include "gpsync.h"
  25.  
  26. /* ------- Synchronization primitives -------- */
  27.  
  28. /* Semaphores */
  29.  
  30. uint
  31. gp_semaphore_sizeof(void)
  32. {
  33.     return sizeof(gp_semaphore);
  34. }
  35.  
  36. int
  37. gp_semaphore_open(gp_semaphore * sema)
  38. {
  39.     if (sema)
  40.     *(int *)sema = 0;
  41.     return 0;
  42. }
  43.  
  44. int
  45. gp_semaphore_close(gp_semaphore * sema)
  46. {
  47.     return 0;
  48. }
  49.  
  50. int
  51. gp_semaphore_wait(gp_semaphore * sema)
  52. {
  53.     if (*(int *)sema == 0)
  54.     return_error(gs_error_unknownerror); /* no real waiting */
  55.     --(*(int *)sema);
  56.     return 0;
  57. }
  58.  
  59. int
  60. gp_semaphore_signal(gp_semaphore * sema)
  61. {
  62.     ++(*(int *)sema);
  63.     return 0;
  64. }
  65.  
  66. /* Monitors */
  67.  
  68. uint
  69. gp_monitor_sizeof(void)
  70. {
  71.     return sizeof(gp_monitor);
  72. }
  73.  
  74. int
  75. gp_monitor_open(gp_monitor * mon)
  76. {
  77.     if (mon)
  78.     mon->dummy_ = 0;
  79.     return 0;
  80. }
  81.  
  82. int
  83. gp_monitor_close(gp_monitor * mon)
  84. {
  85.     return 0;
  86. }
  87.  
  88. int
  89. gp_monitor_enter(gp_monitor * mon)
  90. {
  91.     if (mon->dummy_ != 0)
  92.     return_error(gs_error_unknownerror);
  93.     mon->dummy_ = mon;
  94.     return 0;
  95. }
  96.  
  97. int
  98. gp_monitor_leave(gp_monitor * mon)
  99. {
  100.     if (mon->dummy_ != mon)
  101.     return_error(gs_error_unknownerror);
  102.     mon->dummy_ = 0;
  103.     return 0;
  104. }
  105.  
  106. /* Thread creation */
  107.  
  108. int
  109. gp_create_thread(gp_thread_creation_callback_t proc, void *proc_data)
  110. {
  111.     return_error(gs_error_unknownerror);
  112. }
  113.